package cn.bocweb.spinning.view.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import cn.bocweb.spinning.R;
import cn.bocweb.spinning.model.Bean.CompanySearchLocationBean;
import cn.bocweb.spinning.view.common.MyAdapter;

/**
 * Created by chenchangxing on 16/3/10.
 */
public class SearchLocationCommonAdapter extends MyAdapter<CompanySearchLocationBean.CommonBean> {

    public SearchLocationCommonAdapter(Context context, List<CompanySearchLocationBean.CommonBean> list) {
        super(context, list);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_search_header, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder)convertView.getTag();
        }

        holder.searchHeaderName.setText(list.get(position).getTitle());

        return convertView;
    }

    static class ViewHolder {
        @Bind(R.id.search_header_name)
        TextView searchHeaderName;

        ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
